from urllib.request import urlopen
from bs4 import BeautifulSoup

# 打开网页
html = urlopen('https://mofanpy.com/static/scraping/basic-structure.html').read().decode('utf-8')
# print(html)

# 解析html
soup = BeautifulSoup(html,features='lxml')
#标签选择器
print(soup.h1)
print('\n',soup.p)

all_href = soup.find_all('a')
all_href = [l['href'] for l in all_href]
print('\n', all_href)